package com.designpattern.test;

import com.designpattern.behave.authlink.AuthLink;
import com.designpattern.behave.authlink.AuthNode1;
import com.designpattern.behave.authlink.AuthNode2;
import com.designpattern.behave.authlink.AuthNode3;
import com.designpattern.behave.command.*;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;

@Slf4j
public class BehaveTester {

    @Test
    public void authLinkTest(){
        // 记录下头节点
        AuthLink authLink = new AuthNode1("1");
        authLink.appendNextNode(new AuthNode2("2"))
                .appendNextNode(new AuthNode3("3"));

        authLink.doAuth();
    }

    @Test
    public void commandTest(){
        User user = new User();
        user.addCommand(new CommandImpl(new LogicalImpl()));
        user.addCommand(new CommandImpl2(new LogicalImpl2()));
        user.excuteCommand();
    }
}
